perm filename BFLOAT[F81,JMC] blob
sn#624260 filedate 1981-11-18 generic text, type C, neo UTF8
COMMENT ā VALID 00002 PAGES
C REC PAGE DESCRIPTION
C00001 00001
C00002 00002 bfloat[f81,jmc] comments on big floats for common lisp
C00006 ENDMK
Cā;
bfloat[f81,jmc] comments on big floats for common lisp
LISP already does computation with large integers beter than
many languages intended for numerical computation. I think Common
LISP should be able to handle multiple precision floating point
numbers in a better way than Algol, Fortran, Pascal, etc.
The idea is to handle precision dynamically rather than at
compile time. Each big floating number has encapsulated with it an
integer giving its "precision" in bits. There is a function
(PREC X)
whose value is the precision of X and a function
(SETPREC X N)
whose value is that of X, but whose precision is extended or truncated to
the smallest convenient integer greater than or equal to N. We propose that
SETPREC be non-destructive, so that the original value still remains unless
something like (SETQ X (SETPREC X N)) were done. We say the next convenient
size number, since an integer number of words will actually be used in
an implementation. However, subroutines can use the nominal precision
to decide how many iterations to do or how many terms of an expansion to
use. Conversions to other machines can also be based on the nominal precision.
The operations on big floats should not attempt to guarantee
that the nominal precision corresponds to the accuracy of the numbers.
This probably cannot be done in a uniform way that is suitable for
all numerical purposes. For example, we might standardize the precision
of a sum as the lesser of the precisions of the summands even though
adding -1.95 to 2.00 loses accuracy. Programmers wishing an estimate
of accuracy would further encapsulate the bigfloats with their own
accuracy measures and would define operations that output accuracies
as well as values according to whatever scheme they preferred.
The Common LISP bigfloats with their nominal precisions will be a
useful tool for such tasks.
Some users may fool themselves and others by confusing
precision and accuracy and increasing the precisions of their
numbers without justification. As Larry Niven and Jerry Pournelle
would say, "Think of it as evolution in action".